package com.tedu;

import com.alibaba.druid.pool.DruidDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class DBUtils {
    private static DruidDataSource ds;
    static{
        ds = new DruidDataSource();
        ds.setUrl("jdbc:mysql://localhost:3306/empdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false");
        ds.setUsername("root");
        ds.setPassword("root");
        ds.setInitialSize(10);
        ds.setMaxActive(30);
    }

    public static Connection getConn() throws SQLException {
        Connection conn = ds.getConnection();
        return conn;
    }
}
